﻿using UnityEngine;
using System.Collections;
using System.Xml;

namespace ServerConfig
{
    public class ServerConfig
    {
        public static string GetServer()
        {
            var path = Application.dataPath + "/configserver.xml";
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(path);
            XmlNodeList nodeList = xmlDoc.SelectSingleNode("configserver").ChildNodes;
            XmlElement xl = (XmlElement)nodeList[0];
            return xl.GetAttribute("url");
        }

        public static string GetTestServer()
        {
            var path = Application.dataPath + "/configserver.xml";
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(path);
            XmlNodeList nodeList = xmlDoc.SelectSingleNode("configserver").ChildNodes;
            XmlElement xl = (XmlElement)nodeList[1];
            return xl.GetAttribute("url");
        }
    }
}
